package dao

import (
	"github.com/benji/software/model"
	log "github.com/sirupsen/logrus"
)

func GetQuestionsByID( ids []int)([]*model.Question,error){
	res := make([]*model.Question,0)
	if err := Db.Table("questions").Where("id in (?)",ids).Find(&res).Error;err != nil {
		log.Errorf("GetQuestionByID failed, err: %v",err)
		return nil,err
	}
	return res,nil
}
func GetQuestionsByLevel(level int64)([]*model.Question,error){
	res := make([]*model.Question,0)
	if err := Db.Table("questions").Where("level = ?",level).Find(&res).Error;err !=nil {
		log.Errorf("GetQuestionByLevel failed,err: %v",err)
		return nil,err
	}
	return res,nil
}